<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <p:dialog header="发票信息" widgetVar="billing" modal="true" closable="true" resizable="false" width="1200">
        <p:outputPanel id="bill-info-dialog">
            <div class="ui-g ui-fluid" style="width:100%;">
                <div class="ui-g-2">
                    <p:outputLabel value="主体名称"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.companyName}" disabled="true"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开票公司"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu value="#{settlementBillListBean.settlementBill.receiveCompany}" disabled="true">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems
                                value="#{settlementBillListBean.dictionaries[DictionaryCode.SETTLEMENT_RECEIVE_COMPANY]}"
                                var="dic"
                                itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                    </p:selectOneMenu>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开票内容"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu id="billContent" value="#{settlementBillListBean.settlementBill.billContent}" disabled="true">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems value="#{settlementBillListBean.dictionaries[DictionaryCode.SETTLEMENT_BILLING_CONTENT]}"
                                       var="dic"
                                       itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                    </p:selectOneMenu>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="发票类型"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu id="billType" value="#{settlementBillListBean.settlementBill.billType}" disabled="true">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems value="#{settlementBillListBean.dictionaries[DictionaryCode.SETTLEMENT_BILL_TYPE]}"
                                       var="dic"
                                       itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                    </p:selectOneMenu>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="登记税号"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.taxNumber}" disabled="true"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="电话号码"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.phone}" disabled="true"/>
                </div>



                <div class="ui-g-2">
                    <p:outputLabel value="开户账户(单位名称)"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.bankAccount}" disabled="true"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开户支行"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.bankAddress}" disabled="true"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开户卡号"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.bankNumber}" disabled="true"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开票地址"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.billAddress}" disabled="true"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="收件人姓名"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.receiveName}" disabled="true"/>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="收件人手机"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.receivePhone}" disabled="true"/>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="收件地址"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.receiveAddress}" disabled="true"/>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="财务审核人"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.checkName}" disabled="true"/>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="开票金额" style="color: red"/>
                </div>
                <div class="ui-g-4">
                    <p:inputNumber value="#{settlementBillListBean.settlementBill.billAmount}" disabled="true"/>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="发票号"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementBillListBean.settlementBill.billNumber}" disabled="true"/>
                </div>
                <div class="ui-g-12 padding0">
                    <div class="ui-g-2">
                        <p:outputLabel value="备注"/>
                    </div>
                    <div class="ui-g-10">
                        <p:inputText value="#{settlementBillListBean.settlementBill.remark}" disabled="true"/>
                    </div>
                </div>

                <div class="ui-g-12 padding0">
                    <h2 style="font-weight: bold"><b>附件</b>
                    </h2>
                    <hr style="color: transparent"/>
                </div>
                <div class="ui-g-12 padding0">
                    <p:dataTable var="record" value="#{settlementBillListBean.billAnnexList}"
                                 scrollable="true"
                                 scrollHeight="50" rowIndexVar="index" emptyMessage="无附件" style="text-align: center">
                        <p:column headerText="操作" exportable="false">
                            <p:splitButton icon="fa fa-eye"
                                           process="@this @form" rendered="#{record.fileType=='git'
                                                    || record.fileType=='jpg'
                                                    || record.fileType=='jpeg'
                                                    || record.fileType=='png'}"
                                           actionListener="#{settlementBillListBean.onSeeAnnex(index)}"
                                           oncomplete="PF('annex-image-dialog').show()">
                            </p:splitButton>
                            <p:panel style="border: none" rendered="#{record.fileType=='doc' || record.fileType=='docx'
                                    || record.fileType=='xls' || record.fileType=='xlsx' || record.fileType=='pdf'}">
                                <a style="text-decoration: none;cursor: pointer;" href="#{record.url}">下载</a>
                            </p:panel>
                        </p:column>
                        <p:column headerText="文件名" style="text-align:center;">
                            <h:outputText value="#{record.name}" />
                        </p:column>
                        <p:column headerText="上传人" style="text-align:center;">
                            <h:outputText value="#{record.creator}" />
                        </p:column>
                        <p:column headerText="上传时间" style="text-align:center;">
                            <h:outputText value="#{record.createTime}">
                                <f:convertDateTime pattern="#{constants:get('DATETIME_FORMAT')}"/>
                            </h:outputText>
                        </p:column>
                    </p:dataTable>
                </div>
                <div class="ui-g-12 padding0">
                    <hr style="color: transparent"/>
                </div>
                <div class="ui-g-12 padding0">
                    <h2 style="font-weight: bold">
                        <h:outputText value="预付明细" rendered="#{settlementBillListBean.settlementBill.recordType==1}"/>
                        <h:outputText value="消耗明细" rendered="#{settlementBillListBean.settlementBill.recordType==2}"/>
                        <p:commandButton value="导出" icon="fa fa-download" style="margin-left: 20px;"
                                         ajax="false" rendered="#{settlementBillListBean.settlementBill.recordType==2}">
                            <p:dataExporter type="xls" target="incomeList" fileName="消耗记录"/>
                        </p:commandButton>
                        <p:commandButton value="导出" icon="fa fa-download" style="margin-left: 20px;"
                                         ajax="false" rendered="#{settlementBillListBean.settlementBill.recordType==1}">
                            <p:dataExporter type="xls" target="prepayList" fileName="预付记录"/>
                        </p:commandButton>
                    </h2>


                    <hr style="color: transparent"/>

                </div>

                <div class="ui-g-12 padding0">
                    <p:dataTable id="incomeList" var="record" value="#{settlementBillListBean.incomeList}"
                                 rendered="#{settlementBillListBean.settlementBill.recordType==2}"
                                 scrollable="true"
                                 scrollHeight="80">
                        <p:column headerText="开始时间" style="text-align:center;">
                            <h:outputText value="#{record.startTime}">
                                <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="结束时间" style="text-align:center;">
                            <h:outputText value="#{record.endTime}">
                                <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="产品名称" style="text-align:center;">
                            <h:outputText value="#{record.productName}"/>
                        </p:column>
                        <p:column headerText="收入类型" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementBillListBean.translate(DictionaryCode.SETTLEMENT_INCOME_TYPE,record.incomeType)}"/>
                        </p:column>
                        <p:column headerText="推广方式" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementBillListBean.translate(DictionaryCode.SETTLEMENT_SPREAD_MODE,record.spreadMode)}"/>
                        </p:column>
                        <p:column headerText="推广渠道" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementBillListBean.translate(DictionaryCode.SETTLEMENT_SPREAD_CHANNEL,record.spreadChannel)}"/>
                        </p:column>
                        <p:column headerText="合作模式" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementBillListBean.translate(DictionaryCode.COOPERATION_MODE,record.copMode)}"/>
                        </p:column>
                        <p:column headerText="结算方式" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementBillListBean.translate(DictionaryCode.SETTLEMENT_CYCLE,record.settlementMode)}"/>
                        </p:column>

                        <p:column headerText="结算单价(元)" style="text-align:center;">
                            <h:outputText value="#{record.priceCpa == null ?'-':record.priceCpa}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="结算单价(%)" style="text-align:center;">
                            <h:outputText value="#{record.priceCps == null?'-':record.priceCps}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="注册数" style="text-align:center;">
                            <h:outputText value="#{record.registerCount == null ?'-': record.registerCount}"/>
                        </p:column>
                        <p:column headerText="放款金额" style="text-align:center;">
                            <h:outputText value="#{record.lendAmount == null ?'-': record.lendAmount}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="点击数" style="text-align:center;">
                            <h:outputText value="#{record.clickCount == null ?'-': record.clickCount}"/>
                        </p:column>
                        <p:column headerText="结算金额" style="text-align:center;">
                            <h:outputText value="#{record.incomeAmount}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="创建人" style="text-align:center;">
                            <h:outputText value="#{record.creator}"/>
                        </p:column>
                    </p:dataTable>
                    <p:dataTable id="prepayList" var="record" value="#{settlementBillListBean.prepayList}"
                                 rendered="#{settlementBillListBean.settlementBill.recordType==1}"
                                 scrollable="true"
                                 scrollHeight="100">
                        <p:column headerText="充值日期" style="text-align:center">
                            <h:outputText value="#{record.prepayTime}">
                                <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="主体名称" style="text-align:center;">
                            <h:outputText value="#{record.companyName}" />
                        </p:column>
                        <p:column headerText="结算方式" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementBillListBean.translate(DictionaryCode.SETTLEMENT_CYCLE,record.payType)}"/>
                        </p:column>
                        <p:column headerText="付款方式" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementBillListBean.translate(DictionaryCode.SETTLEMENT_PAY_MODE,record.payMode)}"/>
                        </p:column>

                        <p:column headerText="充值金额" style="text-align:center;">
                            <h:outputText value="#{record.prepayAmount}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="付款账户" style="text-align:center;">
                            <h:outputText value="#{record.payName}"/>
                        </p:column>

                        <p:column headerText="付款账号" style="text-align:center;">
                            <h:outputText value="#{record.payAccount}"/>
                        </p:column>

                        <p:column headerText="收款主体" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementBillListBean.translate(DictionaryCode.SETTLEMENT_RECEIVE_COMPANY,record.receiveCompany)}"/>
                        </p:column>

                        <p:column headerText="创建人" style="text-align:center;">
                            <h:outputText value="#{record.creator}"/>
                        </p:column>
                    </p:dataTable>
                </div>
                <div class="ui-g-12 padding0">
                    <hr style="color: transparent"/>
                </div>

            </div>
        </p:outputPanel>
    </p:dialog>

</html>
